|
|
|
|
|
|
|
Private Sub Form_Resize()
txtData.Move 0, 0, ScaleWidth, ScaleHeight
End Sub
'*********************************************************************
' Let the MDI parent know that this window is being destroyed.
'*********************************************************************
Private Sub Form_Unload(Cancel As Integer)
MDIParent.WindowDestroyed
End Sub |
|
|
|
|
|
|
|
|
One other minor detail you might have noticed in this code is the Form_Resize event. This code makes sure your TextBox control always covers the entire client area of the form. This code works with any control, so keep this in mind for your own applications. |
|
|
|
|
|
|
|
|
Another important concept mentioned previously was that your child forms should use event handlers of the parent menu whenever possible (and vice versa). Listing 17.10 contains the event handlers for all of the menus used by MDICHILD.FRM. |
|
|
|
|
|
|
|
|
Listing 17.10 MDICHILD2.TXTHandling the Menu Code for the Application |
|
|
|
|
|
|
|
|
'*********************************************************************
' Since the child File menu is identical to the MDI parent File menu,
' we should avoid duplicate code by calling the parent's mnuFileItems
' click event.
'*********************************************************************
Private Sub mnuFileItems_Click(Index As Integer)
MDIParent.mnuFileItems_Click Index
End Sub
'*********************************************************************
' The options menu is unique to the child forms, so the code should
' be in the child form or separate BAS module.
'*********************************************************************
Public Sub mnuOptionsItems_Click(Index As Integer)
'*****************************************************************
' Don't stop for errors
'*****************************************************************
On Error Resume Next
'*****************************************************************
' Show the color dialog (since all menu items here need it)
'*****************************************************************
MDIParent.cdlg.ShowColor
'*****************************************************************
' If the use selected cancel, then exit
'*****************************************************************
If Err = cdlCancel Then Exit Sub
'*****************************************************************
' Otherwise set the color based on the value returned from the dlg
'*****************************************************************
Select Case Index
Case 1 'Backcolor . . . |
|
|
|
|
|